Using the shadow map composer

Dynamic shadows are realistic shadows Kanzi calculates based on object geometry, the distance of the object from the light source, and the distance from the object on which the shadow is cast.

In Kanzi to create dynamic shadows you need to use the Shadow Map Composer. These properties of the Shadow Map Composer set the shadows:

For the Shadow Map Composer to work you need a camera that simulates a light source, use the Shadow Receiver Object property on objects that receive shadows, and Shadow Casting Object property on objects that cast shadows.

Creating dynamic shadows

To create dynamic shadows:

  1. Create the objects that cast and receive shadows, in the Properties click Add Properties, and add:
  2. In the Library right-click Composing > Composers and select Create > Shadow Map Composer.
  3. Right-click the Shadow Map Composer and select Create > Render Pass.
  4. In the Project select the scene where you want to create dynamic shadows, and in the Properties set the Composer property to the Shadow Map Composer.
  5. In the Project create a Camera that is used for casting shadows, in the Properties click Add Properties, add the Shadow Caster Camera property, and enable it.
    Create as many cameras in a scene as there are shadow maps. However, make sure that the shader can handle multiple shadow maps.
  6. Place the camera in the scene to the position from where the light is coming. See Setting the position of cameras in the Preview.
  7. In the Project select the objects that receive shadows, and in the Properties set the Material property to PhongShadowMapMaterial.

Adjusting shadows

After setting up your project and objects to cast shadows, adjust the shadows until you get the result you need.

To adjust shadows:

Debugging shadows

To start debugging shadows:

In the Library select Composing > Composers > Shadow Map Composer and in the Properties enable the Shadow Map Visualize Shadow Maps property.
In the bottom-left part of the Preview you can now see your scene as your shadow casting camera sees it. This is the shadow map texture:

See also

Composers